import eq.host;
import eq.timer;
import eq.time;
import eq.stdio;
import eq.math;
import eq.file;
import eq.regexp;
import eq.complex;

print("Test All EQ Language Native Functions\r\n");

a="print";
b=12;
c=4i;
d=true;
e=[1,true];
f=[e,c,4;b];
g=print;

/*
print("core examples 1:print");
print(a,b,c,d,e,f,g);

print("core examples 2:instance");
print(instance());
print(instance([]));
print(instance(a,b,c,d,e,null,g));
*/

/*
print("host examples 1:getcurrentHost");
print(host.getcurrentHost());
print(host.getcurrentHost("operatingSystem","localHostname"));
print(host.getcurrentHost("localHostname"));
print(host.getcurrentHost("qw","operatingSystem","localHostname1"));

print("host examples 2:getEnvironment");
print(host.getEnvironment());
*/
/*
print("timer examples 1:periodic and cancel");
function timer(e,f){
  print(e,f);
  if(f==5){
    print("timer test 5");
    print(timer.isActive($h)); 
    print(timer.getTick($h)); 
    timer.cancel($h);
    print(timer.isActive($h)); 
    print(timer.getTick($h));
  }
}

h = timer.periodic(timer,0,0,1);
print(h); 
print(timer.isActive(h)); 
print(timer.getTick(h)); 
*/

/*
print("stdio examples 1:stdio");

stdio.stderr(f);
stdio.stdin();
stdio.stdout(f);
*/

/*
print("core examples 1:time.getDateTime");
print(time.getDateTime());
*/

/*
print("math examples 1:");
print(math.min(e,c,-4,b));
print(math.max(e,c,4,b));
print(math.getModulo(e,-c,1-4,-b));
print(math.randomInt());
print(math.randomInt(10,3));
print(math.randomInt(20,5));
print(math.randomDouble());
print(math.randomDouble(2));
print(math.randomDouble(3));
print(math.randomBool());
print(math.randomBool(2));
print(math.randomBool(3));
print(math.pow(3,2));
print(math.pow(3,2.5));
print(math.atan2(2,2));
print(math.sin(2,2));
print(math.cos(2,2));
print(math.tan(2,2));
print(math.acos(2,2));
print(math.asin(2,2));
print(math.atan(2,2));
print(math.sqrt(2,2));
print(math.exp(2,2));
print(math.log(2,2));
print(math.pi);
*/

h = "lib\\doc\\examples\\io\\text.text";
hSync = "lib\\doc\\examples\\io\\textSync.text";
j = file.existsSync(h);
jSync = file.existsSync(hSync);

/*
print("file examples 1:exists");
print(file.exists(h));
print(file.exists(h,print));
print(file.existsSync(hSync));

print("file examples 1:create");
print(file.create(h,print));
print(file.createSync(hSync));

print("file examples 1:writeAsBytes");
i=[1,2,30,31,0x31,0x32,0x48];
print(file.writeAsBytes(j,i,print));
print(file.writeAsBytesSync(jSync,i));

print("file examples 1:readAsBytes");
print(file.readAsBytes(j,print));
print(file.readAsBytesSync(jSync));

print("file examples 1:writeAsString");
i="[1,2,30,31,0x31,0x32,0x48]";
print(file.writeAsString(j,i,print));
print(file.writeAsStringSync(jSync,i));

print("file examples 1:readAsString");
print(file.readAsString(j,print));
print(file.readAsStringSync(jSync));

print("file examples 1:readAsLines");
print(file.readAsLines(j,print));
print(file.readAsLinesSync(jSync));

print("file examples 1:rename");
print(file.rename(j,"lib\\doc\\examples\\io\\rename.txt",print));
print(file.renameSync(jSync,"lib\\doc\\examples\\io\\renameSync.txt"));

print("file examples 1:length");
print(file.length(j,print));
print(file.lengthSync(jSync));

print("file examples 1:copy");
print(file.copy(j,"lib\\doc\\examples\\io\\copy.txt",print));
print(file.copySync(jSync,"lib\\doc\\examples\\io\\copySync.txt"));

print("file examples 1:lastAccessed");
print(file.lastAccessed(j,print));
print(file.lastAccessedSync(jSync));

print("file examples 1:setLastAccessed");
print(file.setLastAccessed(j,"2022-08-15T10:47:26.000",print));
print(file.setLastAccessedSync(jSync,"2022-08-15T10:47:26.000"));

print("file examples 1:lastModified");
print(file.lastModified(j,print));
print(file.lastModifiedSync(jSync));

print("file examples 1:setLastModified");
print(file.setLastModified(j,"2022-08-15T10:47:26.000",print));
print(file.setLastModifiedSync(jSync,"2022-08-15T10:47:26.000"));*/

print(complex.add());
print(complex.add(2,4));
print(complex.add(2i,4));
print(complex.add(2,4i));
print(complex.add(2+1i,4+4i));
print(complex.add(2,4));
print(complex.add(2i,4-2i));
print(complex.add(2i,4.0-2i));